<?php
/* @var $this SelisteController */
/* @var $model Seliste */
/* @var $form CActiveForm */
?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'seliste-form',
	'htmlOptions'=>array('class'=>'form-horizontal'),
	'enableAjaxValidation'=>false,
)); ?>

	<?php $labels = $model->attributeLabels();?>

	<p class="note">Les champs marqués d'une <span class="required">*</span> sont requis.</p>

	<?php echo $form->errorSummary($model,NULL,NULL,array("class"=>"alert alert-danger")); ?>

	<div class="form-group<?php if ($model->getErrors('id')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'id',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->textField($model,'id',array("class"=>"form-control","placeholder"=>"Saisir le numéro",'maxlength'=>255,"disabled"=>(($model->isNewRecord) ? "" : "disabled"))); ?></div>
	</div>

	<div class="form-group<?php if ($model->getErrors('nom')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'nom',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->textField($model,'nom',array("class"=>"form-control","placeholder"=>"Saisir le nom",'maxlength'=>255)); ?></div>
	</div>
	
	<div class="form-group<?php if ($model->getErrors('prenom')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'prenom',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->textField($model,'prenom',array("class"=>"form-control","placeholder"=>"Saisir le prénom",'maxlength'=>255)); ?></div>
	</div>
	
	<div class="form-group<?php if ($model->getErrors('pseudo')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'pseudo',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->textField($model,'pseudo',array("class"=>"form-control","placeholder"=>"Saisir le pseudo",'maxlength'=>255,"disabled"=>(($compte && !Yii::app()->user->admin) ? "disabled" : ""))); ?></div>
	</div>
	
	<?php
	if (Yii::app()->user->admin) {
	?>
	<div class="form-group">
		<label class="col-lg-4 control-label">Administration</label>
		<div class="col-lg-8">
			<div class="btn-group" data-toggle="buttons">
				<label class="btn btn-primary<?php if ($model->admin == 1) echo " active";if (Yii::app()->user->id == $model->id) echo " disabled";?>">
					<?php echo $form->checkBox($model,'admin',array("id"=>"checkboxadmin","name"=>"Seliste[admin]","uncheckValue"=>NULL,"value"=>1,"disabled"=>(Yii::app()->user->id == $model->id) ? "disabled" : "")) . $labels['admin']; ?>
				</label>
			</div>
		</div>
	</div>	
	<?php
	}
	?>

	<?php if ($model->isNewRecord) {?>
	
	<div class="form-group<?php if ($model->getErrors('pwd')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'pwd',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->passwordField($model,'pwd',array("class"=>"form-control","value"=>"","placeholder"=>"Saisir le mot de passe",'maxlength'=>255)); ?></div>
	</div>
	
	<div class="form-group<?php if ($model->getErrors('pwd2')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'pwd2',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->passwordField($model,'pwd2',array("class"=>"form-control","value"=>"","placeholder"=>"Confirmer le mot de passe",'maxlength'=>255)); ?></div>
	</div>
	
	<?php } ?>
	
	<div class="form-group<?php if ($model->getErrors('adr')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'adr',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->textField($model,'adr',array("class"=>"form-control","placeholder"=>"Saisir l'adresse",'maxlength'=>255)); ?></div>
	</div>
	
	<div class="form-group<?php if ($model->getErrors('cp')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'cp',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->textField($model,'cp',array("class"=>"form-control","placeholder"=>"Saisir le code postal",'maxlength'=>255)); ?></div>
	</div>
	
	<div class="form-group<?php if ($model->getErrors('ville')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'ville',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->textField($model,'ville',array("class"=>"form-control","placeholder"=>"Saisir la ville",'maxlength'=>255)); ?></div>
	</div>

	<div class="form-group<?php if ($model->getErrors('telfixe')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'telfixe',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->textField($model,'telfixe',array("class"=>"form-control","placeholder"=>"Saisir le téléphone fixe",'maxlength'=>255)); ?></div>
	</div>
	
	<div class="form-group<?php if ($model->getErrors('telport')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'telport',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->textField($model,'telport',array("class"=>"form-control","placeholder"=>"Saisir le téléphone portable",'maxlength'=>255)); ?></div>
	</div>
	
	<div class="form-group<?php if ($model->getErrors('email')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'email',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8"><?php echo $form->textField($model,'email',array("class"=>"form-control","placeholder"=>"Saisir l'adresse email",'maxlength'=>255)); ?></div>
	</div>
	
	<div class="form-group<?php if ($model->getErrors('modecontact')) echo " has-error";?>">
		<?php echo $form->label($model,'modecontact',array("class"=>"col-lg-4 control-label")); ?>
		<div class="col-lg-8">
			<div class="btn-group" data-toggle="buttons">
				<label class="btn btn-primary<?php if ($model->modecontact == 0) echo " active";?>">
					<?php echo $form->radioButton($model,'modecontact',array("id"=>"optionsModecontact0","name"=>"Seliste[modecontact]","uncheckValue"=>NULL,"value"=>0)); ?> Messagerie interne
				</label>
				<label class="btn btn-primary<?php if ($model->modecontact == 1) echo " active";?>">
					<?php echo $form->radioButton($model,'modecontact',array("id"=>"optionsModecontact1","name"=>"Seliste[modecontact]","uncheckValue"=>NULL,"value"=>1)); ?> Email
				</label>
				<label class="btn btn-primary<?php if ($model->modecontact == 2) echo " active";?>">
					<?php echo $form->radioButton($model,'modecontact',array("id"=>"optionsModecontact2","name"=>"Seliste[modecontact]","uncheckValue"=>NULL,"value"=>2)); ?> Téléphone fixe
				</label>
				<label class="btn btn-primary<?php if ($model->modecontact == 3) echo " active";?>">
					<?php echo $form->radioButton($model,'modecontact',array("id"=>"optionsModecontact3","name"=>"Seliste[modecontact]","uncheckValue"=>NULL,"value"=>3)); ?> Téléphone portable
				</label>
			</div>
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-lg-4 control-label">Visibilité des informations</label>
		<div class="col-lg-8">
			<div class="btn-group" data-toggle="buttons">
				<label class="btn btn-primary<?php if ($model->v_nom == 1) echo " active";?>">
					<?php echo $form->checkBox($model,'v_nom',array("id"=>"checkboxv_nom","name"=>"Seliste[v_nom]","uncheckValue"=>0,"value"=>1)) . $labels['v_nom']; ?>
				</label>
				<label class="btn btn-primary<?php if ($model->v_prenom == 1) echo " active";?>">
					<?php echo $form->checkBox($model,'v_prenom',array("id"=>"checkboxv_prenom","name"=>"Seliste[v_prenom]","uncheckValue"=>0,"value"=>1)) . $labels['v_prenom']; ?>
				</label>
				<label class="btn btn-primary<?php if ($model->v_pseudo == 1) echo " active";?>">
					<?php echo $form->checkBox($model,'v_pseudo',array("id"=>"checkboxv_pseudo","name"=>"Seliste[v_pseudo]","uncheckValue"=>0,"value"=>1)) . $labels['v_pseudo']; ?>
				</label>
				<label class="btn btn-primary<?php if ($model->v_adr == 1) echo " active";?>">
					<?php echo $form->checkBox($model,'v_adr',array("id"=>"checkboxv_adr","name"=>"Seliste[v_adr]","uncheckValue"=>0,"value"=>1)) . $labels['v_adr']; ?>
				</label>
				<label class="btn btn-primary<?php if ($model->v_cp == 1) echo " active";?>">
					<?php echo $form->checkBox($model,'v_cp',array("id"=>"checkboxv_cp","name"=>"Seliste[v_cp]","uncheckValue"=>0,"value"=>1)) . $labels['v_cp']; ?>
				</label>
				<label class="btn btn-primary<?php if ($model->v_ville == 1) echo " active";?>">
					<?php echo $form->checkBox($model,'v_ville',array("id"=>"checkboxv_ville","name"=>"Seliste[v_ville]","uncheckValue"=>0,"value"=>1)) . $labels['v_ville']; ?>
				</label>
			</div>
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-lg-4 control-label">Visibilité des modes de contact</label>
		<div class="col-lg-8">
			<div class="btn-group" data-toggle="buttons">
				<label class="btn btn-primary<?php if ($model->v_telfixe == 1) echo " active";?>">
					<?php echo $form->checkBox($model,'v_telfixe',array("id"=>"checkboxv_telfixe","name"=>"Seliste[v_telfixe]","uncheckValue"=>0,"value"=>1)) . $labels['v_telfixe']; ?>
				</label>
				<label class="btn btn-primary<?php if ($model->v_telport == 1) echo " active";?>">
					<?php echo $form->checkBox($model,'v_telport',array("id"=>"checkboxv_telport","name"=>"Seliste[v_telport]","uncheckValue"=>0,"value"=>1)) . $labels['v_telport']; ?>
				</label>
				<label class="btn btn-primary<?php if ($model->v_email == 1) echo " active";?>">
					<?php echo $form->checkBox($model,'v_email',array("id"=>"checkboxv_email","name"=>"Seliste[v_email]","uncheckValue"=>0,"value"=>1)) . $labels['v_email']; ?>
				</label>
			</div>
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-lg-4 control-label">Me notifier par email lorsque je reçois</label>
		<div class="col-lg-8">
			<div class="btn-group" data-toggle="buttons">
				<label class="btn btn-primary<?php if ($model->notif_message == 1) echo " active";?>">
					<?php echo $form->checkBox($model,'notif_message',array("name"=>"Seliste[notif_message]","uncheckValue"=>0,"value"=>1)) . $labels['notif_message']; ?>
				</label>
				<label class="btn btn-primary<?php if ($model->notif_demande == 1) echo " active";?>">
					<?php echo $form->checkBox($model,'notif_demande',array("name"=>"Seliste[notif_demande]","uncheckValue"=>0,"value"=>1)) . $labels['notif_demande']; ?>
				</label>
			</div>
		</div>
	</div>
	
	<div class="form-group<?php if ($model->getErrors('date_inscr')) echo " has-error";?>">
		<?php echo $form->labelEx($model,'date_inscr',array("class"=>"col-lg-4 control-label")); ?>
		<div class="row">
			<?php $model->date_inscr = Yii::app()->dateFormatter->format('dd/MM/yyyy',$model->date_inscr);?>
			<div class="col-lg-3"><?php echo $form->textField($model,'date_inscr',array("class"=>"form-control","placeholder"=>"Choisir la date d'inscription","disabled"=>(($compte && !Yii::app()->user->admin) ? "disabled" : ""))); ?></div>
			<span class="help-block">Format : jour/mois/année ; exemple : 28/12/2013</span>
		</div>
	</div>

	<div class="form-group">
		<div class="col-lg-offset-4 col-lg-8">
			<?php if ($compte) {?>
				<?php echo CHtml::submitButton('Sauvegarder les modifications',array("class"=>"btn btn-primary")); ?>
				<?php echo CHtml::link("Annuler",array('seliste/compte'),array('class'=>"btn btn-sm btn-info"));	?>
			<?php } else {?>
				<?php echo CHtml::submitButton($model->isNewRecord ? 'Ajouter le séliste' : 'Sauvegarder le séliste',array("class"=>"btn btn-primary")); ?>
				<?php echo CHtml::link($model->isNewRecord ? "Annuler l'ajout" : "Annuler",array('seliste/admin'),array('class'=>"btn btn-sm btn-info"));	?>
			<?php }?>
		</div>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->